import subprocess,os,time,pyautogui
woking_dir = os.getcwd()
print(woking_dir)
woking_dir= '/home/theyn/town_ws'
pkg_name = 'village_li'
node_name= 'li4_node'

os.chdir(woking_dir)  # 切换到指定目录
os.system("gnome-terminal") #
time.sleep(0.3)
pyautogui.write('colcon build')
pyautogui.press('enter')
pyautogui.write('source install/setup.bash')
pyautogui.press('enter')
pyautogui.write(f'ros2 run {pkg_name} {node_name}')
pyautogui.press('enter')
time.sleep(3)
pyautogui.hotkey('ctrl', 'z')


